# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
from pymongo import MongoClient



class FangPipeline(object):
    def process_item(self, item, spider):
        self.c.insert_one(item)
        print('管道开启')
        return item

    def open_spider(self, spider):
        client = MongoClient()
        self.c = client['fang']['fang']
